package com.example.flashApp.usage

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import java.util.Date

@Dao
interface UsageDao {

    @Insert
    suspend fun insert(usageEntity: UsageEntity)

    @Query("SELECT * FROM usage_stats WHERE timestamp BETWEEN :start AND :end ORDER BY usageDuration DESC")
    suspend fun getUsageBetweenDates(start: Date, end: Date): List<UsageEntity>

    @Query("DELETE FROM usage_stats WHERE timestamp < :date")
    suspend fun deleteOlderThan(date: Date)
}
